<extend name="Public/base" />
<block name="style">

</block>
<block name="body">

    <!-- 标题栏 -->
    <div class="main-title">
        <h2>商品列表</h2>
    </div>
    <div class="cf">
        <div class="fl">
            <form action="" method="POST">
                <input type="text" name="keywords" class="text input-4x" value="{$keywords}" placeholder="商品ID/商品名称" />&nbsp; &nbsp;
                分类:
                <select name="cate_id">
                    <volist name="Menus" id="menu">
                        <option value="{$menu.cate_id}" <?php if($menu['cate_id']==$cate_id){ echo 'selected';} ?>>{$menu.title_show}</option>
                    </volist>
                </select>
                <select name="center_id">
                    <option value="0" >-请选择所属中心-</option>
                    <volist name="center" id="vo">
                        <option value="{$vo.center_id}" <?php if($vo['center_id']==$center_id){ echo 'selected';} ?>>{$vo.center_name}</option>
                    </volist>
                </select>
                <button class="btn" type="submit">筛选</button>
                <a class="btn" href="{:U('add')}">新 增</a>

            </form>
            <!--            <button class="btn ajax-post confirm" url="{:U('changeStatus?method=deleteUser')}" target-form="ids">删 除</button>-->
        </div>
        <!-- 高级搜索 -->
        <div class="search-form fr cf">
            <!--<a class="sch-btn" href="javascript:;" id="search" url="{:U('index')}"><i class="btn-search"></i></a>-->
        </div>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
        <table class="">
            <thead>
                <tr>
                    <th class="">商品ID</th>
                    <th class="">所属分类</th>
                    <th class="">所属中心</th>
                    <th class="">商品名称</th>
                    <th class="">商品价格</th>
                    <th class="">商品主图</th>
                    <th class="">状态</th>
                    <th class="">收藏数</th>
                    <th class="">创建时间</th>
                    <th class="">更新时间</th>
                    <th class="">操作</th>
                </tr>
            </thead>
            <tbody>
            <notempty name="_list">
                <volist name="_list" id="vo">
                    <tr>
                        <td>{$vo.goods_id} </td>
                        <td>{$vo.title}</td>
                        <td>{$vo.center_name}</td>
                        <td>{$vo.goods_name}</td>
                        <td>{$vo.price}</td>
                        <td>
                            <a href="__ROOT__{$vo['head_img']}"  target="_blanck">
                                <img src="__ROOT__{$vo['head_img']}" width="50" height="50">
                            </a>
                        </td>
                        <td>
                    <if condition="$vo.status eq 0"> 
                        正常
                        <elseif condition="$vo.status eq 1"/>
                        已下架
                    </if>
                    </td>
                    <td>{$vo.user_collect_num}</td>
                    <td>{$vo.create_time}</td>
                    <td>{$vo.update_time}</td>
                    <td>
                    <if condition="$vo.status eq 0"> 
                        <a href="{:U('setstatus',array('id'=>$vo['goods_id'],'s'=>1))}" class="confirm ajax-get">下架</a>
                        <elseif condition="$vo.status eq 1"/>
                        <a href="{:U('setstatus',array('id'=>$vo['goods_id'],'s'=>0))}" class="confirm ajax-get">上架</a>
                    </if>
                    <a href="{:U('add',array('id'=>$vo['goods_id']))}" class="">编辑</a>
                    <a href="{:U('del',array('id'=>$vo['goods_id']))}" class="confirm ajax-get">删除</a>

                    </td>
                    </tr>
                </volist>
                <else/>
                <td colspan="20" class="text-center"> aOh! 暂时还没有内容! </td>
            </notempty>
            </tbody>
        </table>
    </div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

    <script type="text/javascript">
        //搜索功能
        $("#search").click(function () {
            var url = $(this).attr('url');
            var query = $('.search-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            query = query.replace(/^&/g, '');
            if (url.indexOf('?') > 0) {
                url += '&' + query;
            } else {
                url += '?' + query;
            }
            window.location.href = url;
        });
        //回车搜索
        $(".search-input").keyup(function (e) {
            if (e.keyCode === 13) {
                $("#search").click();
                return false;
            }
        });
        //导航高亮

        highlight_subnav("{:U('Goods/index')}");
    </script>
</block>
